#include "SudokuNakedSingles.h"

SudokuNakedSingles::SudokuNakedSingles(QObject* parent) :
        SudokuAbstractSolvingTechnique("Naked Singles", NakedSingles, FindValue, parent)
{
}

int SudokuNakedSingles::solve()
{
    for(int i=0; i<mSudokuData->getCellCount(); ++i)
    {
        if(mSudokuData->cellAt(i)->isEmpty())
        {
            if(mSudokuData->cellAt(i)->countPossible() == 1)
            {
                int ind = mSudokuData->cellAt(i)->getFirstPossibleIndex();
                mSudokuData->onFoundValue(mSudokuData->cellAt(i)->getRow(), mSudokuData->cellAt(i)->getCol(), ind+1, mType);
                mCount++;
            }
        }
    }
    qDebug() << "SudokuNakedSingles::solve mCount: " << mCount;
    return mCount;
}
